/*
 *         Copyright (c) KUBOTA Corporation and HUDSON SOFT,
 *                  1994, 1995 All Rights Reserved
 *
 *  This software comprises unpublished confidential information of
 *  KUBOTA Corp. and HUDSON SOFT. It may not be used, copied or made 
 *  available to anyone, except in accordance with the license under
 *  which it is furnished.
 */
static char SccsId[] = "@(#)ltest.c	1.5	9/19/95";
#include <farl.h>
#include <agl.h>

unsigned int cube[] = {
#include "cyl2.h"
};

object		ox, oy, oz;
Material	mt1;

void
main()
{
     register int	i, j;
     register int	lno;
     unsigned short	lvcolor;
     char	a;

     FX73init();
     FX73_cmap_i6c3();
     AGLInit();

     FarlSetPEICMaskReg(FARL_ICMASK_I6C3);
     FarlSetTEControlReg(FARL_TE_LTEN|FARL_TE_ICM|FARL_TE_SPEN|FARL_TE_BCE);
     FarlValidateSwap();

     mt1.ambient   = 0x1000;
     mt1.diffuse  = 0x3fff;
     mt1.specular = 0x3fff;

     ox.geometryTop    = oy.geometryTop    = oz.geometryTop = cube;
     ox.geometryLength = oy.geometryLength = oz.geometryLength
	  = sizeof(cube)/sizeof(int);
     ox.material = oy.material = oz.material = &mt1;

     AGLResetCamera();
     AGLTranslateCamera(0x0, 0x0, 0x80);
     AGLRotateCameraX(200);
     AGLZoomCamera(0x40, 0x40, 0x40);

     AGLResetObj(&ox); AGLResetObj(&oy); AGLResetObj(&oz);
     AGLScaleObj(&ox, 0x60, 0x60, 0x60);
     AGLScaleObj(&oy, 0x60, 0x60, 0x60);
     AGLScaleObj(&oz, 0x60, 0x60, 0x60);
     AGLRotateObjZ(&ox, 900);
     AGLRotateObjX(&oz, 900);
     AGLTranslateObj(&ox, 0xff80, 0x0, 0x0);
     AGLTranslateObj(&oz, 0x80, 0x0, 0x0);

     for (j = 0; j < 2; j++) {
	  lno = (j == 0? AGL_LIGHT0 : AGL_LIGHT1);
	  lvcolor = 0x805 + j;

	  AGLSetLightStrength(j==0? AGL_LIGHT1 : AGL_LIGHT0, 0x0);
	  AGLSetLightStrength(lno, 0x7fff);

	  AGLSetMaterial(&mt1, 1); /* ƒ‰ƒCƒg‹­“x‚ðƒ}ƒeƒŠƒAƒ‹‚É”½‰f‚³‚¹‚é */

	  /* ƒ‰ƒCƒg‚ð‚wŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightX(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);
	    
	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚xŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightY(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚yŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightZ(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚w‚xŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚w‚yŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚x‚yŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚x‚wŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚y‚wŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚y‚xŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚w‚x‚yŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚x‚w‚yŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚w‚y‚xŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚x‚y‚wŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚y‚w‚xŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }

	  /* ƒ‰ƒCƒg‚ð‚y‚x‚yXŽ²‰ñ“] */
	  for (i = 0 ;i <= 3600; i += 10) {
	       AGLResetLight(lno);
	       AGLRotateLightZ(lno, (i*2)%3600);
	       AGLRotateLightY(lno, (i*2)%3600);
	       AGLRotateLightX(lno, (i*2)%3600);

	       AGLFixPutObj(&ox);
	       AGLFixPutObj(&oy);
	       AGLFixPutObj(&oz);

	       AGLDrawLightVector(lno, lvcolor);

	       AGLShot();
	  }
     }
     return;
}
